<template>
  <div class="div1">
    <h2>父子组件</h2>
    <span>子组件传递给父组件的值是：{{ toy }}</span>
    <!-- send-toy: 自定义事件名称 -->
    <TongXin2Child @send-toy="getToy" />
  </div>
</template>
<script setup lang="ts">
import TongXin2Child from './TongXin2Child.vue'
import { ref } from 'vue'

const toy = ref('')

const getToy = (value: string, num: number) => {
  toy.value = value
  console.log(num);
}

</script>
<style lang="scss" scoped>
.div1 {
  background-color: #f5f5f5;
  padding: 20px;
  border: 1px solid #eee;
}

</style>
